<template>
    <view class="capacity">
<!--        <video id="myVideo"-->
<!--               :src="videoUrl"-->
<!--               :controls="false"-->
<!--               :enable-progress-gesture="false"-->
<!--               autoplay-->
<!--        ></video>-->
        <web-view ref="webView" class="webView" :src="webViewUrl" v-if="webViewUrl"></web-view>
    </view>
</template>

<script>
    import { $http } from '../../static/common/js/http.js'
    export default {
        data() {
            return {
                videoUrl: '',
                webViewUrl: '',
                title: ''
            }
        },
        computed: {
        },
        onShow() {
        },
        onLoad(options) {
            this.getData(options.cameraCode)
            uni.setNavigationBarTitle({
                title:options.cameraName
            })
            this.title = options.cameraName
        },
        methods: {
            videoErrorCallback: function() {
                uni.showModal({
                    title: '提示',
                    content: '播放失败',
                    showCancel: false
                })
            },
            getData(cameraCode){
                const vm = this
                uni.showLoading({
                    title: '加载中'
                });
                $http('/fenghuoImp/indexAct/app/play.html', 'post', {
                        cameraCode: cameraCode
                    },
                    res => {
                        console.log(res,'9999')
                        vm.videoUrl = res.data
                        vm.webViewUrl = '/static/html/videoHtml.html?videoUrl=' +res.data + '&title=' + this.title
                        uni.hideLoading();
                    },
                    err => {
                        console.log(err,'err')
                    }
                )
            }
        }
    }
</script>

<style lang="scss" scoped>
    .capacity {
        width: 100%;
        padding: 40rpx 0;
    }
    #myVideo{
        width: 750rpx!important;
    }
</style>
